﻿Imports BUS
Imports DTO

Public Class frmcapnhatbophan

    Private Sub btnthoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnthoat.Click
        Me.Close()
    End Sub

    Public Sub LoadBoPhan()
        dtgvdsbophan.Rows.Clear()
        Dim ds As New List(Of BoPhanDTO)()
        Dim bus As New BoPhanBUS()
        ds = bus.LayDSBoPhan()
        For i As Integer = 0 To ds.Count - 1
            dtgvdsbophan.Rows.Add(ds(i).MaBoPhan, ds(i).TenBoPhan)
        Next
    End Sub

    Private Sub frmcapnhatbophan_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        LoadBoPhan()
    End Sub

    Private Sub btncapnhat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncapnhat.Click
        If dtgvdsbophan.CurrentRow.Index >= 0 Then
            Dim frm As New frmxlcapnhatbophan()
            frm.MaBoPhan = dtgvdsbophan.Item(0, dtgvdsbophan.CurrentRow.Index).Value
            frm.TenBoPhan = dtgvdsbophan.Item(1, dtgvdsbophan.CurrentRow.Index).Value
            If frm.ShowDialog() = Windows.Forms.DialogResult.OK Then
                LoadBoPhan()
            End If
        Else
            MessageBox.Show("Chưa chọn bằng cấp !")
        End If
    End Sub
End Class